<template>
  <div>
    父组件
    <hr />
    <MySon :a="m" b="200"></MySon>
    <hr />
    <!-- 父向子传的数据类型没有限制 传任意类型 字符串 数字 对象 数组 -->
    <!-- v-for也可以用于循环组件 -->
    <MyProduct v-for="item in list" :key="item.id" :product="item"></MyProduct>
  </div>
</template>

<script>
import MySon from "./my-son.vue";
import MyProduct from "./my-product.vue";
export default {
  data() {
    return {
      m: 200,
      list: [
        { id: 1, proname: "超级好吃的棒棒糖", proprice: 18.8 },
        { id: 2, proname: "超级好吃的大鸡腿", proprice: 34.2 },
        { id: 3, proname: "超级无敌的冰激凌", proprice: 14.2 },
      ],
    };
  },
  components: {
    MySon,
    MyProduct,
  },
};
</script>

<style scoped></style>
